import { useRequest, defaultFormatResult } from '@/hooks';
import { getHirePositionAndRank } from '@/pages/Recruitment/service';

const usePositionAndRank = employId => {
    const { data, loading } = useRequest(() => getHirePositionAndRank(employId), {
        ...defaultFormatResult,
        ready: !!employId
    });
    if (!data) return {};
    return {
        positionName: `${data.positionName} ${data.rankValue}`,
        loading,
        ...data
    };
};

export default usePositionAndRank;
